package com.macro.mall.portal.controller;

import com.macro.mall.common.api.CommonPage;
import com.macro.mall.common.api.CommonResult;
import com.macro.mall.portal.service.CiCollegeInfoService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * CiCollegeInfo的路由接口服务
 * 
 * @author 
 *
 */
@Slf4j
@RestController
@RequestMapping("college")
@Api(tags = "学院管理", description = "学院管理")
public class CiCollegeInfoController {

	/** CiCollegeInfoService服务 */
	@Autowired
	private CiCollegeInfoService ciCollegeInfoService;
	
	/**
	 * 查询所有CiCollegeInfo数据的方法
	 * @param
	 * @return
	 */
	@GetMapping(value = "/list", produces = {"application/json;charset=UTF-8"})
	public CommonResult find(@RequestParam(value = "id", defaultValue = "1") String id,
                             @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                             @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize) {
		return CommonResult.success(CommonPage.restPage(ciCollegeInfoService.find(id, pageNum,pageSize)));
	}
	
	/**
	 * 通过id查询CiCollegeInfo数据的方法
	 * @param id
	 * @return
	 */
	@GetMapping(value = "/getById", produces = {"application/json;charset=UTF-8"})
	public CommonResult findOne(@RequestParam(name="id") Integer id) {
		return CommonResult.success(ciCollegeInfoService.findOne(id));
	}
}
